#include<stdio.h>
int main()
{
	int a,b,i;
	char c;
	double p1,p2,r;
	scanf("%d %d %c",&a,&b,&c);
	switch(b){
		case 90: p1 = 6.95; break;
		case 93: p1 = 7.44; break;
		case 97: p1 = 7.93; break;
	}
	switch(c){
		case 'm': p2 = 0.95; break;
		case 'e': p2 = 0.97; break;
	}
	r=a*p1*p2;
	printf("%.2f",r);
	return 0;
}
